package com.health.appoint.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 排班表
 * @TableName schedule
 */
@TableName(value ="schedule")
@Data
public class Schedule implements Serializable {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 医生地址
     */
    private String doctorAddress;

    /**
     * 
     */
    private Long doctorId;

    /**
     * 医院地址
     */
    private String hospitalAddress;

    /**
     * 可预约日期
     */
    private Date availableDate;

    /**
     * 可用时间段 例如："09:00"-"09:30"
     */
    private String timeSlot;

    /**
     * 最大预约数
     */
    private Integer maxAppointments;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 是否删除 0-未删除 1-删除 过了可用时间段会删除
     */
    @TableLogic
    private Integer isDelete;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Schedule other = (Schedule) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getDoctorAddress() == null ? other.getDoctorAddress() == null : this.getDoctorAddress().equals(other.getDoctorAddress()))
            && (this.getDoctorId() == null ? other.getDoctorId() == null : this.getDoctorId().equals(other.getDoctorId()))
            && (this.getHospitalAddress() == null ? other.getHospitalAddress() == null : this.getHospitalAddress().equals(other.getHospitalAddress()))
            && (this.getAvailableDate() == null ? other.getAvailableDate() == null : this.getAvailableDate().equals(other.getAvailableDate()))
            && (this.getTimeSlot() == null ? other.getTimeSlot() == null : this.getTimeSlot().equals(other.getTimeSlot()))
            && (this.getMaxAppointments() == null ? other.getMaxAppointments() == null : this.getMaxAppointments().equals(other.getMaxAppointments()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getDoctorAddress() == null) ? 0 : getDoctorAddress().hashCode());
        result = prime * result + ((getDoctorId() == null) ? 0 : getDoctorId().hashCode());
        result = prime * result + ((getHospitalAddress() == null) ? 0 : getHospitalAddress().hashCode());
        result = prime * result + ((getAvailableDate() == null) ? 0 : getAvailableDate().hashCode());
        result = prime * result + ((getTimeSlot() == null) ? 0 : getTimeSlot().hashCode());
        result = prime * result + ((getMaxAppointments() == null) ? 0 : getMaxAppointments().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", doctorAddress=").append(doctorAddress);
        sb.append(", doctorId=").append(doctorId);
        sb.append(", hospitalAddress=").append(hospitalAddress);
        sb.append(", availableDate=").append(availableDate);
        sb.append(", timeSlot=").append(timeSlot);
        sb.append(", maxAppointments=").append(maxAppointments);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", isDelete=").append(isDelete);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}